package com.human.server.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.human.server.entity.Departments;
import com.human.server.entity.KpiDepartments;
import com.human.server.mapper.KpiDepartmentsMapper;
import com.human.server.service.DepartmentsService;
import com.human.server.mapper.DepartmentsMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

/**
* @author Admin
* @description 针对表【departments(部门信息表)】的数据库操作Service实现
* @createDate 2025-09-06 00:57:17
*/
@Service
public class DepartmentsServiceImpl extends ServiceImpl<DepartmentsMapper, Departments>
    implements DepartmentsService {

    @Autowired
    private KpiDepartmentsMapper kpiDepartmentsMapper;

    public List<Long> kpiIds(Departments departments) {
        return kpiDepartmentsMapper.selectList(new LambdaQueryWrapper<KpiDepartments>()
                .eq(KpiDepartments::getDepartmentId, departments.getId()))
                .stream()
                .map(KpiDepartments::getKpiId)
                .collect(Collectors.toList());
    }
}




